package com.vitabuybuy.tv.dto;

import androidx.databinding.BaseObservable;

import com.vitabuybuy.tv.utils.LanaugeUtils;

import java.util.List;

/**
 * 作者：SimGa
 * 日期：2020/12/8
 * 时间：11:45
 * 包名：com.vitabuybuy.tv.dto
 */
public class CartGoodsDetailsDto {
    /**
     * name : 李艺科潮男装卖店
     * itemList : [{"amount":1,"product":{"thumbnail":"http://106.55.47.138/attachment/jpg/3007/137_14959.jpg","name":"airjordan1","id":12},"quantity":1,"price":1,"available":true,"goods":{"id":9},"id":1,"specifications":"{\"EN\":\"black\",\"ZH\":\"黑色\",\"MA\":\"hitam\"};{\"EN\":\"L\",\"ZH\":\"L\",\"MA\":\"L\"}"}]
     * id : 12
     */

    private String name;
    private int id;
    private boolean isChecked;
    private List<ItemListBean> itemList;

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<ItemListBean> getItemList() {
        return itemList;
    }

    public void setItemList(List<ItemListBean> itemList) {
        this.itemList = itemList;
    }

    public static class ItemListBean extends BaseObservable {
        /**
         * amount : 1
         * product : {"thumbnail":"http://106.55.47.138/attachment/jpg/3007/137_14959.jpg","name":"airjordan1","id":12}
         * quantity : 1
         * price : 1
         * available : true
         * goods : {"id":9}
         * id : 1
         * specifications : {"EN":"black","ZH":"黑色","MA":"hitam"};{"EN":"L","ZH":"L","MA":"L"}
         */

        private int amount;
        private ProductBean product;
        private int quantity;
        private int price;
        private boolean available;
        private GoodsBean goods;
        private int id;
        private String specifications;
        private boolean isChecked;

        public boolean isChecked() {
            return isChecked;
        }

        public void setChecked(boolean checked) {
            isChecked = checked;
        }

        public int getAmount() {
            return amount;
        }

        public void setAmount(int amount) {
            this.amount = amount;
        }

        public ProductBean getProduct() {
            return product;
        }

        public void setProduct(ProductBean product) {
            this.product = product;
        }

        public int getQuantity() {
            return quantity;
        }

        public void setQuantity(int quantity) {
            this.quantity = quantity;
        }

        public int getPrice() {
            return price;
        }

        public void setPrice(int price) {
            this.price = price;
        }

        public boolean isAvailable() {
            return available;
        }

        public void setAvailable(boolean available) {
            this.available = available;
        }

        public GoodsBean getGoods() {
            return goods;
        }

        public void setGoods(GoodsBean goods) {
            this.goods = goods;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getSpecifications() {
            String[] split = specifications.split(";");
            specifications = "";
            for(String spec : split){
                String str = LanaugeUtils.returnStrByLocation(spec);
                specifications = specifications.concat(str).concat(";");
            }
            return specifications.isEmpty() ? specifications : specifications.substring(0,specifications.length() - 1);
        }

        public void setSpecifications(String specifications) {
            this.specifications = specifications;
        }

        public static class ProductBean {
            /**
             * thumbnail : http://106.55.47.138/attachment/jpg/3007/137_14959.jpg
             * name : airjordan1
             * id : 12
             */

            private String thumbnail;
            private String name;
            private int id;

            public String getThumbnail() {
                return thumbnail;
            }

            public void setThumbnail(String thumbnail) {
                this.thumbnail = thumbnail;
            }

            public String getName() {
                return LanaugeUtils.returnStrByLocation(name);
            }

            public void setName(String name) {
                this.name = name;
            }

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }
        }

        public static class GoodsBean {
            /**
             * id : 9
             */

            private int id;
            private String image;


            public String getImage() {
                return image;
            }

            public void setImage(String image) {
                this.image = image;
            }

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }
        }
    }
}
